package com.qipay.withdraw.config;

/**
 * Creator: Yao
 * Date:    2017/9/27
 * For:
 * Other:
 */
public enum WithdrawTypeEnum {

    AVAILABLE((byte) 0, "可用余额"),
    ADVANCE((byte) 1, "垫支余额");

    private byte type;
    private String info;

    WithdrawTypeEnum(byte type, String info) {
        this.type = type;
        this.info = info;
    }

    public byte getType() {
        return type;
    }

    public void setType(byte type) {
        this.type = type;
    }

    public String getInfo() {
        return info;
    }

    public void setInfo(String info) {
        this.info = info;
    }

    public static String getInfo(Byte type) {

        String info = "";

        if (null != type) {
            for (WithdrawTypeEnum p : WithdrawTypeEnum.values()) {
                if (type.equals(p.getType())) {
                    info = p.getInfo();
                    break;
                }
            }
        }

        return info;
    }

    public static boolean contains(String type){
        for(WithdrawTypeEnum typeEnum : WithdrawTypeEnum.values()){
            if(typeEnum.name().equals(type)){
                return true;
            }
        }
        return false;
    }
}
